

from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.core import *
from qgis.gui import *

# import resources

import doGam
import doBesagnewell

import os
import tempfile

class DClusterPlugin(object):
  def __init__(self, iface):
    # Save a reference to the QGIS iface
    self.iface = iface
    self.canvas = iface.mapCanvas()

  def initGui(self):
    # Create action
    self.menu=QMenu("Clustering")

    self.gam = QAction("GAM",self.iface.mainWindow())
    self.gam.setWhatsThis("Openshaw GAM")
    QObject.connect(self.gam, SIGNAL("activated()"), self.runGAM)

    self.menu.addActions([self.gam])

    menuBar = self.iface.mainWindow().menuBar()
    menuBar.addMenu(self.menu)

  def unload(self):
    pass
    # Remove the plugin
    #self.iface.removePluginMenu("DCluster",self.action)
    #self.iface.removeToolBarIcon(self.action)

  def runGAM(self):
    # Change the tool to the rasterinfo tool
    d = doGam.Dialog(self.iface)
    d.exec_()

